! leave room for RESN icon, margin, and cellSkip
#avail=#rightMargin$-#rightSkip-#cellSkip-#hpos$-29

if @this.FAMS=""
  ! edit field with value
  cell PopupMenuEdit
  if @contents="Male"
    MenuItems local("Male")&":Male"
  else
    MenuItems local("Male")&":M"
  endif
  if @contents="Female"
    MenuItems local("Female")&":Female"
  else
    MenuItems local("Female")&":F"
  endif
  if @contents="Undetermined"
    MenuItems local("Undetermined")&": Undetermined"
  else
    MenuItems local("Undetermined")&":U"
  endif
  MenuItems local("(not specified)")&"::"
  SizeToFit
  help local("Select sex")
else
  cell LinkButton
  if @contents="M"
    set text local("Male")
  else if @contents="F"
    set text local("Female")
  else if @contents="U"
    set text local("Undetermined")
  else if @contents!=""
    set text local(@contents)
  else
    set text "?"
  endif
  set border shadowlesssquare
  SizeToFit 18
  MenuLink "Attach Changed Sex"
  help local("Click to change this person's sex")
endif

#margin=(#avail-#cellWidth$)/2
if #margin>0
  shift #margin
  hskip #margin
endif
